package com.zhoug.zmui.valuepair;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

import androidx.annotation.Nullable;

/**
 * 键值对水平布局组件:文本
 * @Author HK-LJJ
 * @Date 2020/3/23
 * @Description
 */
public class ZMUIKeyValueText extends ZMUIAbsKeyValueView<TextView> {
    public ZMUIKeyValueText(Context context) {
        this(context, null);
    }

    public ZMUIKeyValueText(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ZMUIKeyValueText(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public TextView getValueView() {
        if(valueView==null){
            return new TextView(getContext());
        }
        return valueView;
    }
    @Override
    public String getValue() {
        if(valueView!=null){
            return valueView.getText().toString();
        }
        return null;
    }

    @Override
    public void setValue(CharSequence value) {
        if(valueView!=null){
            valueView.setText(value);
        }
    }
    @Override
    protected void _setStatusColor(int statusColor) {
        if(valueView!=null){
            valueView.setTextColor(statusColor);
        }
    }
}
